<template>
	<div class="index">

		<div class="center">
			<left></left>
			<div class="right">
          <top></top>
          <div class="hei10"></div>
		  <keep-alive :include="includsname">
                <router-view></router-view>
			</keep-alive>
			</div>
		</div>
		<!-- <foot></foot> -->
	</div>
</template>

<script>
	import axios from "axios";
	import top from '@/components/top.vue'
	import left from '@/components/left.vue'
	import foot from "@/components/foot.vue"
	export default{
		components: {
			"left": left,
			"top": top,
			"foot": foot
		},
		name: 'order_examine',
		data(){
			return{
				msg:"hello",
				options:"",
				value:"",
				includsname:[],
      			shopid:''
			}
		},
		created(){
    var that = this
    this.shopid = JSON.parse(localStorage.getItem('SHOP')).shop_id

    var namearr = []
    var getarr = JSON.parse(localStorage.getItem('LOCAL_NAV'+this.shopid))
    for(var x = 0;x<getarr.length;x++){
      namearr.push(getarr[x].name1)
      if(getarr[x].name2!=''){
        namearr.push(getarr[x].name2)
      }
    }
    that.includsname = namearr
    // console.log('namearr——app')
    //     console.log(that.includsname)
  },
  mounted(){
      
      var that = this
      
      // 监听localhostStorage的数据变化，结合utils/tool.js配合使用
      window.addEventListener('setItemEvent', function(e) {
        var namearr = []
        if(e.key == 'LOCAL_NAV'+that.shopid){
          var getarr = JSON.parse(e.newValue)
          for(var x = 0;x<getarr.length;x++){
            namearr.push(getarr[x].name1)
            if(getarr[x].name2!=''){
              namearr.push(getarr[x].name2)
            }
          }
          that.includsname = namearr
          // console.log('namearr——app')
          // console.log(that.includsname)
        }
       
       
        
      })
    },
	}
</script>

<style lang="scss" scoped>
	.index{
		.team{ background: #F9F9F9;}
		.powertop{ display: flex; width: 640px; }
		.powertopli{ flex-basis: 160px; line-height: 45px; border-top: 4px #F9F9F9 solid; color: #727272; border-right: 1px #F9F9F9 solid; font-size: 14px; text-align: center;}
		.powertopact{ background: #FFFFFF; border-top: 4px #DD2727 solid;}
	}
</style>
